import request from '@/utils/request'

// 获取角色列表
export function getRoles(params) {
  return request({
    url: '/sys/role',
    method: 'GET',
    params
  })
}

export function getCompanyInfo(id) {
  return request({
    url: `/company/${id}`,
    method: 'GET'
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

// 获取id
export function getRoleId(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'GET'
  })
}
// 编辑功能
export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除角色id
export function delRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
